<!doctype html>
<html lang="en" ng-app="myApp">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../../../../../css/onsenui.css"/>
    <link rel="stylesheet" href="../../../../../css/onsen-css-components.css"/>

    <script src="../../../node_modules/onsenui/js/onsenui.js"></script>
    <script src="../../../node_modules/angular/angular.js"></script>
    <script src="../../../dist/angularjs-onsenui.js"></script>
    <script>
      angular.module('myApp', ['onsen']).controller('TestController', function($scope) {
        ons.createDialog('dialog.html', {parentScope: $scope}).then(function(dialog) {
          dialog.show();
          $scope.dialog = dialog;
        });
      });
    </script>
  </head>
  <body>
    <ons-navigator var="navi">
      <ons-page id="page1">
        <p style="text-align: center;">
          <ons-button id="push-page" ng-click="navi.pushPage('page2.html')">Go to page 2</ons-button>
        </p>
      </ons-page>
    </ons-navigator>

    <ons-template id="page2.html">
      <ons-page id="page2" ng-controller="TestController">
        <p style="text-align: center;">
          <ons-button id="pop-page" ng-click="dialog.destroy(); navi.popPage()">Go back</ons-button>
        </p>
      </ons-page>
    </ons-template>

    <ons-template id="dialog.html">
      <ons-dialog var="dialog" animation="none">
        <p style="text-align: center;">
          <ons-button id='hide-dialog' ng-click="dialog.hide()">Hide</ons-button>
        </p>
      </ons-dialog>
    </ons-template>
  </body>
</html>
